package com.chen.authority.model.vo;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.chen.authority.entity.ExcelVerifyInfoEntity;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;

/**
 * 用户 视图对象
 *
 * @author chengy
 * @date 2022/11/24
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class UserVo extends ExcelVerifyInfoEntity {

    @ApiModelProperty("用户id")
    private Integer id;

    @ApiModelProperty("用户名")
    @Excel(name = "用户名", width = 20)
    @NotBlank(message = "不能为空")
    private String username;

    @ApiModelProperty("密码")
    private String password;

    @ApiModelProperty("名称")
    @Excel(name = "名称", width = 20)
    @NotBlank(message = "不能为空")
    private String name;

    @ApiModelProperty("部门id")
    private Integer departmentId;

    @ApiModelProperty("部门名称")
    @Excel(name = "部门", width = 20)
    private String departmentName;

    @ApiModelProperty("岗位id")
    private Integer postId;

    @ApiModelProperty("岗位名称")
    @Excel(name = "岗位", width = 20)
    private String postName;

    @ApiModelProperty("邮箱")
    @Excel(name = "邮箱", width = 20)
    @NotNull(message = "不能为空")
    @Email(message = "格式有误")
    private String email;

    @ApiModelProperty("手机号")
    @Excel(name = "手机号", width = 20)
    private String phoneNumber;

    @ApiModelProperty("性别（1男 0女）")
    @Excel(name = "性别", width = 20, replace = {"男_1", "女_0"})
    private Integer sex;

    @ApiModelProperty("用户头像")
    private String imgUrl;

    @ApiModelProperty("备注")
    @Excel(name = "备注", width = 20)
    private String remark;

    @ApiModelProperty("状态（1启用 0禁用）")
    @Excel(name = "状态", width = 20, replace = {"启用_1", "禁用_0"})
    private Integer status;

    @ApiModelProperty("登录时间")
    private Date loginTime;

    @ApiModelProperty("上次登录时间")
    private Date lastLoginTime;

    @ApiModelProperty("创建时间")
    private Date createTime;

    @ApiModelProperty("角色列表")
    private List<RoleVo> roles;

    @ApiModelProperty("菜单权限列表")
    private List<String> menuPermissions;

    @ApiModelProperty("导入角色名称")
    @Excel(name = "角色", width = 20)
    private String roleName;

    @JsonIgnore
    private String departmentAncestors;

}